package pe.com.hermes.hermetic.web.controller.autenticacion;

import pe.com.hermes.hermetic.web.forms.AutenticarForm;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@RequestMapping("/logout.html")
@Controller
public class LogoutController {
    private final static String FORM_LOGIN_VIEW = ".login";
    private final static String FORM_KEY = "form"; 
    private Logger logger = Logger.getLogger(this.getClass());
    @RequestMapping(method=RequestMethod.GET)
    protected String showForm(ModelMap model,HttpServletRequest request) throws Exception{
        HttpSession session = request.getSession(false);
        session.invalidate();
        model.put(FORM_KEY,new AutenticarForm());
        return FORM_LOGIN_VIEW;
    }
}
